package goodbaby.dklt.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.classic.core.fragment.BaseFragment;

import goodbaby.dklt.R;
import goodbaby.dklt.activity.AttendanceActivity;
import goodbaby.dklt.activity.CourseActivity;

/**
 * Created by Jayden on 2016/4/19 14:02.
 *
 * @version V1.0
 * @Title: StudyFragment
 * @Description: 班级页面
 */
public class StudyFragment extends BaseFragment {

    public static int fromAttendance = 0;
    public static int fromCourse = 2;
    public static int fromLeave = 1;
    public static int fromRecipe = 3;
    private RelativeLayout rlAttendance;
    private RelativeLayout rlCourse;
    private RelativeLayout rlLeave;
    private RelativeLayout rlRecipe;
    private TextView tvTitle;

    public int getLayoutResId() {
        return R.layout.fragment_study;
    }

    public void initData() {
        super.initData();
    }

    public void initView(View paramView) {
        super.initView(paramView);
        tvTitle = (TextView) paramView.findViewById(R.id.tv_common_title);
        tvTitle.setText("班级");
        rlAttendance = (RelativeLayout) paramView.findViewById(R.id.rl_attendance);
        rlAttendance.setOnClickListener(this);
        rlLeave = (RelativeLayout) paramView.findViewById(R.id.rl_leave);
        rlLeave.setOnClickListener(this);
        rlCourse = (RelativeLayout) paramView.findViewById(R.id.rl_course);
        rlCourse.setOnClickListener(this);
        rlRecipe = (RelativeLayout) paramView.findViewById(R.id.rl_recipe);
        rlRecipe.setOnClickListener(this);
    }

    public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle) {
        return super.onCreateView(paramLayoutInflater, paramViewGroup, paramBundle);
    }

    public void onDestroyView() {
        super.onDestroyView();
    }

    public void viewClick(View paramView) {
        super.viewClick(paramView);
        switch (paramView.getId()) {
            default:
                break;
            case R.id.rl_attendance:
                Intent localIntent4 = new Intent(getActivity(), AttendanceActivity.class);
                localIntent4.putExtra("fromItem", fromAttendance);
                startActivity(localIntent4);
                break;
            case R.id.rl_leave:
                Intent localIntent3 = new Intent(getActivity(), AttendanceActivity.class);
                localIntent3.putExtra("fromItem", fromLeave);
                startActivity(localIntent3);
                break;
            case R.id.rl_course:
                Intent localIntent2 = new Intent(getActivity(), CourseActivity.class);
                localIntent2.putExtra("fromItem", fromCourse);
                startActivity(localIntent2);
                break;
            case R.id.rl_recipe:
                Intent localIntent1 = new Intent(getActivity(), CourseActivity.class);
                localIntent1.putExtra("fromItem", fromRecipe);
                startActivity(localIntent1);
                break;
        }

    }
//    public static int fromAttendance = 0;
//    public static int fromLeave = 1;
//
//    private TextView tvTitle;
//    private RelativeLayout rlAttendance, rlLeave, rlCourse, rlRecipe;
//
//    @Override
//    public int getLayoutResId() {
//        return R.layout.fragment_study;
//    }
//
//    @Override
//    public void initData() {
//        super.initData();
//    }
//
//    @Override
//    public void initView(View parentView) {
//        super.initView(parentView);
//        tvTitle = (TextView) parentView.findViewById(R.id.tv_common_title);
//        tvTitle.setText("班级");
//        rlAttendance = (RelativeLayout) parentView.findViewById(R.id.rl_attendance);
//        rlAttendance.setOnClickListener(this);
//        rlLeave = (RelativeLayout) parentView.findViewById(R.id.rl_leave);
//        rlLeave.setOnClickListener(this);
//        rlCourse = (RelativeLayout) parentView.findViewById(R.id.rl_course);
//        rlCourse.setOnClickListener(this);
//        rlRecipe = (RelativeLayout) parentView.findViewById(R.id.rl_recipe);
//        rlRecipe.setOnClickListener(this);
//    }
//
//    @Override
//    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//        return super.onCreateView(inflater, container, savedInstanceState);
//    }
//
//    @Override
//    public void onDestroyView() {
//        super.onDestroyView();
//    }
//
//    @Override
//    public void viewClick(View v) {
//        super.viewClick(v);
//        switch (v.getId()) {
//            case R.id.rl_attendance:
//                Intent attendanceIntent = new Intent(getActivity(), AttendanceActivity.class);
//                attendanceIntent.putExtra("fromItem", fromAttendance);
//                startActivity(attendanceIntent);
//                break;
//            case R.id.rl_leave:
//                Intent leaveIntent = new Intent(getActivity(), AttendanceActivity.class);
//                leaveIntent.putExtra("fromItem", fromLeave);
//                startActivity(leaveIntent);
//                break;
//            case R.id.rl_course:
////                Intent attendanceIntent = new Intent(getActivity(), AttendanceActivity.class);
////                startActivity(attendanceIntent);
//                break;
//            case R.id.rl_recipe:
////                Intent attendanceIntent = new Intent(getActivity(), AttendanceActivity.class);
////                startActivity(attendanceIntent);
//                break;
//            default:
//                break;
//        }
//    }
}
